#ifndef __BSP_LCD_ST7789_H__
#define __BSP_LCD_ST7789_H__

#include "stm32f4xx.h"		/* STM32F4xx头文件 */

#define RCC_LCD_ST7789_PORT (RCC_AHB1Periph_GPIOB)		/* GPIO端口时钟 */

#define LCD_ST7789_CS_PORT	    GPIOB
#define LCD_ST7789_CS_PIN	    GPIO_Pin_8

#define LCD_ST7789_SCK_PORT	    GPIOB
#define LCD_ST7789_SCK_PIN	    GPIO_Pin_3

#define LCD_ST7789_MOSI_PORT	GPIOB
#define LCD_ST7789_MOSI_PIN	    GPIO_Pin_5

// #define LCD_ST7789_MISO_PORT	GPIOB
// #define LCD_ST7789_MISO_PIN	    GPIO_Pin_4

#define LCD_ST7789_DC_PORT      GPIOB
#define LCD_ST7789_DC_PIN	    GPIO_Pin_9

#define LCD_ST7789_RST_PORT     GPIOB
#define LCD_ST7789_RST_PIN	    GPIO_Pin_7

#define LCD_ST7789_BLK_PORT     GPIOB
#define LCD_ST7789_BLK_PIN	    GPIO_Pin_0

#define LCD_DISPLAY_ORIENTATION LCD_DISPLAY_ORIENTATION_PORTRAIT

#define LCD_DISPLAY_ORIENTATION_PORTRAIT				0		// 纵向
#define LCD_DISPLAY_ORIENTATION_PORTRAIT_INVERTED		1		// 纵向翻转
#define LCD_DISPLAY_ORIENTATION_LANDSCAPE				2		// 横向
#define LCD_DISPLAY_ORIENTATION_LANDSCAPE_INVERTED		3		// 横向翻转


extern uint16_t LCD_Width;		// LCD 宽度
extern uint16_t LCD_Height;   // LCD 高度
extern uint8_t  LCD_Orientation;// 默认纵向

void bsp_lcd_st7789_init(void);
void bsp_lcd_backlight_on(void);
void bsp_lcd_backlight_off(void);
void bsp_lcd_st7789_refresh_test(void);
void bsp_lcd_write_cmd(uint8_t cmd);
void bsp_lcd_write_data(uint8_t data);
void bsp_lcd_write_multidata(uint8_t *pData, uint32_t len);
void bsp_lcd_write_data_16bit(uint16_t _ucData);
void bsp_lcd_setwindows(uint16_t Start_X, uint16_t Start_Y,uint16_t End_X,uint16_t End_Y);
void bsp_lcd_clear(uint16_t Color);
void bsp_lcd_fill(uint16_t Start_X, uint16_t Start_Y, uint16_t End_X, uint16_t End_Y, uint16_t Color);
void bsp_lcd_fill_color(uint16_t Start_X, uint16_t Start_Y, uint16_t End_X, uint16_t End_Y, uint16_t *Color);
void bsp_lcd_set_orientation(uint8_t orientation); 


#endif /* __BSP_LCD_ST7789_H__ */
